#include<stdio.h>
#include<sys/ipc.h>
#include<string.h>

 struct msgbuf {
    long mtype;       /* message type, must be > 0 */
    char mtext[255];    /* message data */
};
int main(){
    //创建消息队列
    int que_id = msgget(0x12121212, IPC_CREAT | 0664);
    if(que_id < 0){
        perror("msgger");
        return 0;
    }
    printf("que_id is %d\n", que_id);
    //组织要发送的信息
    struct msgbuf mb;
    mb.mtype = 2;
    const char* str = "I am send msg process";
    strcpy(mb.mtext,str);
    //发送
    msgsnd(que_id, &mb, sizeof(mb.mtext), 0);
    return 0;
}

